# 序列化
from  rest_framework import serializers
from datetime import datetime

#预约课程
from apitest.models import Project


class AppointSerializer(serializers.Serializer):
    environment = serializers.CharField(max_length=16)
    phone_teacher = serializers.CharField(max_length=32)
    pw_teacher = serializers.CharField(max_length=32)
    phone_student = serializers.CharField(max_length=32)
    pw_student = serializers.CharField(max_length=32)

#创建项目
class ProjectSerializer(serializers.Serializer):
    project_name = serializers.CharField(max_length=32, required=True)
    owner_id = serializers.IntegerField(required=True)
    desc = serializers.CharField(max_length=400, required=True)

    def create(self, validated_data):
        project = Project.objects.create(**validated_data)
        return project

